/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package escuela;

import javax.persistence.EntityManagerFactory;

/**
 *
 * @author Bryan
 */
public class conexion {

    private static final conexion singleton = new conexion();
    protected EntityManagerFactory emf;
    protected conexion(){
    }
    public static conexion ObtenerInstancia(){
        return singleton;
    }
    public EntityManagerFactory ObtenerEMF(){
        if(emf==null){
            CrearEMF();
        }
        return emf;
    }
    public void CrearEMF(){
        this.emf = javax.persistence.Persistence.createEntityManagerFactory("EscuelaPU2");
    }


}
